
## ============================================
## code

## -- -- -- -- -- --
## regression_khandelwal_demand.R
data input: 
	aggregate_monthly_panel.csv		(prices, quantities, etc.)
	natural_coding.csv			(SKU natural coding)
	USD RUB Historical Data.csv		(exchange rate daily)
data output:
	khandelwal_residuals.csv

Table A.3, Figure A.4, plus data used in reduced form analysis

## -- -- -- -- -- --
## analyze_reduced_form.R
data input:
	aggregate_monthly_panel.csv		(monthly microdata)
	materials.csv				(SKU materials)
	natural_coding.csv			(SKU natural coding)	
	erdats.csv				(exchange rate)
	khandewal_residuals.csv			(khandewal residuals for SKUs)
no data output

all tables and figures not mentioned

## -- -- -- -- -- --
## regression_flight_from_quality.R
data input:
	mdat.csv				(monthly microdata)
	dt3_nonylon.csv				(SKU natural coding)
	erdats.csv				(exchange rate)
	pdat_raw.csv				(russian provinces sales monthly panel)
	regional_growth2010-15.csv		(russian province growth rates)
	regional_growth.csv			(russian province growth)
no data output

Table B.12, B.13, Figure B.5

## -- -- -- -- -- --
## robustness_HS6_khandelwal.R
data input:
	(monthly HS6 comtrade data, multiple datasets)
	IMF_ER_data.csv					(multiple exchange rates)
	(other exchange rates from investing.com)	(multiple exchange rates)
	Cushing_OK_WTI_Spot_Price_FOB.csv		(oil prices)
	capital_city_latlong.csv			(distances)
	WtoData_20200729153100.csv			(WTO tariffs)
	country_populations.csv				(country population)
no data output	

Table B.14


## -- -- -- -- -- --
## model_simulations.R
data input: none
no data output

Figure C.1, C.2


## ============================================
## DATA

## -- -- -- -- -- --
## SOURCES

aggregate_monthly_panel, provincial_monthly_panel, materials, and natural_coding were provided by the firm

regional_growth and regional_growth2010-15 was taken from the federal state statistics service https://eng.gks.ru/
exchange rates were taken from the international statistics of the IMF and investing.com
	e.g. https://ca.investing.com/currencies/usd-bgn-historical-data

for the generalization, see sources.txt in the generalization folder

## -- -- -- -- -- --
## data dictionary

aggregate_monthly_panel:
	date: monthly date, date type
	product_sku: unique sku identifier, character
	orders: gross product sales, numeric
	sales: product sales net of returns, numeric
	premium_1s: firm-designated "premium" coding, boolean
	price: modal posted price of ordered products in rubles, numeric
	price2: modal posted price of sold products in rubles, numeric
	sale_price: modal sale price of ordered products in rubles, numeric
	sale_price2: modal sale price of sold products in rubles, numeric
	brand: unique brand identifier, character
	targetgroup: product category, character
	season_1s: firm-designated season for that sku, character
	cog_n: wholesale cost of goods in rubles, numeric
	eurrub: euro-ruble exchange rate monthly average, numeric
	usdrub: usd-ruble exchange rate monthly average, numeric

provincial_monthly_panel
	as in aggregate_monthly_panel, with additions:
	region: province (oblast) identifier, character

materials
	as in aggregate_monthly_panel, with additions:
	material: component materials raw, character
	pct: percent of the sku comprised of that material, numeric
	production_country: country of origin, character
	mat: cleaned component materials, character
	rus: russian production origin

natural_coding
	as in aggregate_monthly_panel, with additions:
	rusbrand: russian brand, boolean
	nat: coded as natural or not, boolean
	haspolymer: has a polymer material, boolean


erdats
	season: start date of season associated with season_1s, date
	price: average rubles per USD that season
	l0, l1, l2, p1: contemporaneous, one season lagged, two season lagged, one season forward lagged ERs, numeric


regional_growth
	region: province (oblast) identifier, character
	econgr2015: GDP per capita growth from 2014-2015, numeric
	unemp_rate: unemployment rate, numeric
	mean_month_income: average monthly income in rubles in 2015, numeric

regional_growth2010-15
	region: province (oblast) identifier, character
	yr2010, yr2011, yr2012, yr2013, yr2014, yr2015: GDP per capita in 20xx, numeric

USD RUB Historical Data
	Date: day, date
	Price: average rubles per USD that day, numeric
	Open: rubles per USD at trading open, numeric
	High: intraday max of rubles per USD, numeric 
	Low: intraday min of rubles per USD, numeric
	Change: change from previous day of rubles per USD, numeric


## ============================================
## software and OS used to run code

R version 3.5.1 (2018-07-02) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

Microsoft R Open 3.5.1
The enhanced R distribution from Microsoft
Microsoft packages Copyright (C) 2018 Microsoft Corporation













##